#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

int dfs(vector<vector<int>> &gh, vector<int> &vis, int u, int &cnt)
{
        vis[u] = 1;
        cnt++;
        for(auto v : gh[u]){
                if(!vis[v]){
                        dfs(gh, vis, v, cnt);
                }
        }
        return cnt;
}

int main()
{
        int n;
        cin >> n;
        vector<vector<int>> gh(n + 1);
        vector<int> degree(n + 1, 0);
        vector<int> vis(n + 1, 0);
        for(int i = 0; i < n - 1; i++){
                int u, v;
                cin >> v >> u;
                gh[u].push_back(v);
                degree[v]++;
        }

        int cnt = 0;
        for(int i = 1; i <= n; i++){
                if(degree[i] == 0){
                        fill(vis.begin(), vis.end(), 0);
                        cnt = 0;
                        if(dfs(gh, vis, i, cnt) == n){
                                cout<<i<<endl;
                                break;
                        }
                }
        }
        if(cnt != n){
                cout << -1 << endl;
        }
        return 0;
}